package com.google.cbmgraph.data;

import java.util.ArrayList;

import android.os.Parcel;
import android.os.Parcelable;

public class DataSourceList extends ArrayList<String> implements Parcelable{

	/**
	 * This object extends ArrayList<String> so that it is parsable between the 
	 * SplashScreen Activity and the menu it is serializable so has a UID
	 */
	private static final long serialVersionUID = -2526793005408276645L;

	/**
	 * Constructors
	 */
	public DataSourceList(){
		
	}
	public DataSourceList(Parcel in){
		readFromParcel(in);
	}
	/**
	 * Annonymous class to parcel the object
	 */
	@SuppressWarnings({ "rawtypes" })
	public static final Parcelable.Creator CREATOR = new Parcelable.Creator(){
		public DataSourceList createFromParcel(Parcel in){
			return new DataSourceList(in);
		}
		public Object[] newArray(int arg0){
			return null;
		}
	};
	/**
	 * reads from parcel
	 */
	private void readFromParcel(Parcel in){
		this.clear();
		int size = in.readInt();
		for (int i = 0; i< size; i++){
			this.add(in.readString());
		}
	}
	/**
	 * overridden function
	 */
	@Override
	public int describeContents() {
		return 0;
	}
	/**
	 * writes to parcel
	 */
	@Override
	public void writeToParcel(Parcel dest, int flags) {
		int size = this.size();
		dest.writeInt(size);
		for(int i = 0; i<size; i++){
			dest.writeString(this.get(i));
		}
		
	}

}
